home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
2101_200
/
DISK2170
/
DISK2170.ZIP
/
PC_EXER.C
< prev
next >
Wrap
Text File
|
1989-11-11
|
2KB
|
82 lines
/*----------------------------------------------------------------------------
quick 'n dirty excercise program for pc_util.c
----------------------------------------------------------------------------*/
#include "stdio.h"
#include "pc_hedr.h"
unsigned char w_buf [4000]; /* window save buffer */
/*-----------------------------------------------*/
main ()
{
int delay;
cls ();
paints (0, 0, "Press any key and watch !\n", HII, 25);
paints (3, 0, "Press <x> for window transfer\n", REB, 30);
paints (18, 18, " Press <q> to quit\n", REV, 19);
boxc (14, 69, 10, 10, 0xb1, NOR);
box2 (15, 70, 8, 8, NOR);
box1 (16, 71, 6, 6, HII);
box3 (1, 37, 22, 5, NOR);
while (1)
{
char key;
char scan;
delay = 5000;
while (delay != 0)
{
if (delay == 5000)
{
paints (21, 20, " hello world ! \n", NOR, 16);
painta (18, 26, NOR, 1);
cursor (25, 80);
}
if (delay == 2500)
{
paints (21, 20, " how ya doing ? \n", REV, 16);
painta (18, 26, REV, 1);
cursor (25, 80);
}
delay -= 1;
if (keybuffer_stat())
{
scan = keybuffer_scan (); /* get scan code */
key = rd_keystroke (); /* get keystroke & flush keyboard buffer */
if (key == 'x')
move_box();
paintc (3, 40, ' ', HII, 16); /* blank line & set to HII */
printf ("ASCII CHAR = %c\n", key);
paintc (4, 40, ' ', HII, 16); /* blank line & set to HII */
printf ("ASCII CODE = %x\n", key);
paintc (5, 40, ' ', HII, 16); /* blank line & set to HII */
printf ("SCAN CODE = %x\n", scan);
cursor (25, 80);
if (key == 'q')
exit(0); /* exit program @ 'q' */
}
};
};
}
/*-----------------------------------------------*/
move_box ()
{
window_save (1, 37, 23, 6, w_buf);
window_restore (10, 0, 23, 6, w_buf);
}
/*-----------------------------------------------*/